<template>
	<div>
		<div class="graybg"></div>
		<!--头部-->
		<div id="header">
			<div class="header clearfix header_bg" >
				<div class="header_center baiColor">天支付</div>
				<div class="header_right">
					<router-link to="/message">
					<i class="iconfont baiColor" style="font-size: 18px;">&#xe616;
						<small v-if="news" class="small" v-text="length"></small>
					</i>
					
					</router-link>
				</div>
			</div>
			
		</div>
		<!--=头部导航=-->
		<div class="header_nav header_bg _width">
			<div class="header_nav-main marginAuto">
				<div class="header_nav_each" onClick="qrcode('0','qrcodeCallback')">
					<h5 class="iconfont">&#xe65a;</h5>
					<p>扫码</p>
				</div>
				<div class="header_nav_each">
					<router-link to="/wdrainage">
						<h5 class="iconfont ">&#xe646;</h5>
						<p class="ellipsis01">引流送积分</p>
					</router-link>
				</div>
				<div class="header_nav_each" @click="code">
					<h5 class="iconfont">&#xe63b;</h5>
					<p>二维码</p>
				</div>
				<div class="header_nav_each" @click="transfer">
					<h5 class="iconfont">&#xe63f;</h5>
					<p>转账</p>
				</div>
			</div>
		</div>
		<!--=列表=-->
		<div class="list marginAuto">
			<div class="list_each">
				<div class="item">
					<router-link to="/wintegral">
					<h5 class="iconfont">&#xe672;</h5>
					<p>积分管理</p>
					</router-link>
				</div>
				<div class="item">
					<router-link to="/wbalance">
					<h5 class="iconfont">&#xe601;</h5>
					<p>余额管理</p>
					</router-link>
				</div>
			</div>
			<div class="list_each">
				<div class="item">
					<router-link to="/wpayment">
					<!--<router-link :to="{name:'wpayment',params:{one:ones,two:twos}}">-->
					<h5 class="iconfont">&#xe602;</h5>
					<p>货款钱包</p>
					</router-link>
				</div>
				<div class="item">
					<router-link to="/huiyuan">
					<h5 class="iconfont">&#xe67e;</h5>
					<p>会员</p>
					</router-link>
				</div>
			</div>
			<div class="list_each">
				<div class="item">
					<router-link to="/addCard">
					<h5 class="iconfont">&#xe670;</h5>
					<p>银行卡</p>
					</router-link>
				</div>
				<div class="item">
					<router-link to="/shezhi">
					<h5 class="iconfont">&#xe609;</h5>
					<p>设置</p>
					</router-link>
				</div>
			</div>
		</div>
		<!--弹窗-->
		<!--=转账=-->
		<div class="keepOut" :class="{transferdata:transfershow}"></div>
		<div class="transferBlock" :class="{transferdata:transfershow}">
			<div class="transferBlock_header">
				<span>转账</span>
			</div>
			<div class="transferBlock_main _width">
				<div class="transferBlock_each">
					<router-link :to="{name:'wwork',params:{id:codeturn}}">
					<h5><img src="../assets/whuojifen.png" alt="活积分"/></h5>
					<p>活积分转账</p>
					</router-link>
				</div>
				<div class="transferBlock_each">
					<router-link to="/wbalancez">
					<h5><img src="../assets/wyue.png" alt="余额"/></h5>
					<p>余额转账</p>
					</router-link>
				</div>
				<div class="transferBlock_each" @click="wfreeze">
					<h5><img src="../assets/wdongjifen.png" alt="冻积分"/></h5>
					<p>冻积分转账</p>
				</div>
			</div>
			<div class="footer_button button baiColor" @click="closeZ">
				<span>取消</span>
			</div>
		</div>
		<!--=二维码=-->
		<div class="keepOut" :class="{codedata:codeshow}"></div>
		<div class="transferBlock" :class="{codedata:codeshow}">
			<div class="transferBlock_header">
				<span>二维码</span>
			</div>
			<div class="transferBlock_main _width">
				<div class="transferBlock_each">
					<router-link to="/wpersonagecode">
					<h5><img src="../assets/wpersonagecode.png" alt="商家收款二维码"/></h5>
					<p>商家收款二维码</p>
					</router-link>
				</div>
				<div class="transferBlock_each">
					<router-link to="/wmerchantcode">
					<h5><img src="../assets/wmerchantcode.png" alt="个人推广二维码"/></h5>
					<p>个人推广二维码</p>
					</router-link>
				</div>
			</div>
			<div class="footer_button button baiColor" @click="closeE">
				<span>取消</span>
			</div>
		</div>
		<!--底部tab-->
		<tab></tab>
	</div>
</template>

<script>
	import store from '../vuex/store.js';
	import tab from './table.vue';
	export default {
		components:{tab},
		data(){
			return{
//				ones:"111",
//				twos:"222",
				codeturn:"&",
				news:false,
				length:"",//消息数量
				xinxi:"",
				//控制转账选项显示隐藏
				transfershow:false,	
				//控制二维码显示隐藏
				codeshow:false
				
			}
		},
		mounted(){
			var info = window.localStorage.data;
			var params = new URLSearchParams();
			if(info == undefined){
				_this.$router.push("wlogin")
			};
			//          获取消息的个数
	          var params = new URLSearchParams();
	          var info = window.localStorage.data;
	          params.append("token", info); //客户秘钥（信息）
	          params.append("type", 0);
	          this.$axios({
	            url: "Home/Index/msg",
	            method: "POST",
	            data: params
	          }).then(res => {
	            if(res.data.code == 1){
	            	this.news = true;
	            this.length = res.data.data
	          }else if(res.data.code == 2){
	          	this.news = false;
	          }
	        }).catch(function(err) {
	            console.log(err);
	          });
	        
		},
		computed:{
			shuju(){
				return store.state.shuju
			}
		},
		methods:{
			//扫码回调
			qrcodeCallback:function (result){
			    alert(result);
			    window.location.href=result;
			        //result为扫描的数据结果。
			},
			//	二维码
			//冻积分跳转
			wfreeze(){
				var arr= ["u_level"];
				let _this = this;
				var info = window.localStorage.data;
				var params = new URLSearchParams();
				params.append('token', info);	//客户秘钥（信息）
				params.append('arr',arr);
				this.$axios({
				   url:"Home/Config/getUserField",
					method:"post",
					data:params
				   }).then(function(res){
				   	if(res.data.data.u_level >= 3){
				   		_this.$router.push("wfreeze")
				   	}else{
				   		alert("您还是三星级以上用户，暂不支持此功能")
				   	}
				}).catch(function(err){
					console.log(err)		
				})
			},
			code(){
				this.codeshow = true;
			},
			closeE(){
				this.codeshow = false;
			},
			//转账
			transfer(){
				this.transfershow = true;
			},
			closeZ(){
				this.transfershow = false;
			}
			
		}
		
	}
</script>

<style scoped="scoped">
	@import "../css/public.css";
	@import "../css/wShares.css";
	.header{
		z-index: 100;
	}
	.keepOut{
		top: 0;
		z-index: 101;
	}
	.transferdata{
		display: block;
	}
	.codedata{
		display: block;
	}
	.footer_button{
		background:#FCB616;
	}
	/*通知提醒小红点*/
	.header_right i small{
		font-size: 10px;
	    display: inline-block;
	    width: 14px;
	    height: 14px;
	    text-align: center;
	    border-radius: 50%;
	    color: #fff;
	    background: #FF0000;
	    position: absolute;
	    top: -5px;
	    right: -10px;
	}
</style>